Script to copy keyvault secrets between keyvaults
$sourceVaultName = "keyvaultName" $destVaultName = "keyvaultName" Connect-AzAccount $sourceSub = 'subScriptionId' $destSub = 'subScriptionId' Set-AzContext -Subscription $sourceSub $secretNames = (Get-AzKeyVaultSecret -VaultName $sourceVaultName).Name Set-AzContext -Subscription $destSub $secretNames.foreach{ Set-AzKeyVaultSecret -VaultName $destVaultName -Name $_ ` -SecretValue (Get-AzKeyVaultSecret -VaultName $sourceVaultName -Name $_).SecretValue }